package wjl.project.dubbotestshop;

import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLUpdate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public interface GoodsRepository extends JpaRepository<Goods,Long> {

   @Transactional
   @Modifying
   @Query("update Goods as g set g.goodsNum = ?1 where g.goodsId = ?2 ")
   int updateGoodsNum(Integer goodsNum, Long goodsId);
}
